package com.basic.modules.nykf.controller;

import com.basic.common.utils.PageUtils;
import com.basic.common.utils.ParamsModel;
import com.basic.common.utils.R;
import com.basic.modules.nykf.entity.CustomerShopBusinessEntity;
import com.basic.modules.nykf.entity.RenewShouEntity;
import com.basic.modules.nykf.entity.RenewTuiEntity;
import com.basic.modules.nykf.service.RenewManageTwoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("new/ykf/renewManageTwo")
public class RenewManageTwoController {

    @Autowired
    RenewManageTwoService renewManageTwoService;

    /**
     * 续费业务列表
     *
     * @param params
     * @return
     */
    @PostMapping("/getRenewYwList")
    public R getRenewYwList(@RequestBody ParamsModel<CustomerShopBusinessEntity> params) {
        PageUtils page = renewManageTwoService.getRenewYwList(params);
        return R.ok(page);
    }

    /**
     * 获取首次收款数据
     *
     * @param map
     * @return
     */
    @PostMapping("/getScskList")
    public R getScskList(@RequestBody Map map) {
        return R.ok(renewManageTwoService.getScskList(map));
    }

    /**
     * 首次收款提交-业务人员在创建业务时使用
     *
     * @param map
     * @return
     */
    @PostMapping("/postScsk")
    public R postScsk(@RequestBody Map map) {
        return renewManageTwoService.postScsk(map);
    }

    /**
     * 创建续费订单并且返回已支付及正在续费的订单
     *
     * @param map
     * @return
     */
    @PostMapping("/createRenewOrder")
    public R createRenewOrder(@RequestBody Map map) {
        return R.ok(renewManageTwoService.createRenewOrder(map));
    }

    /**
     * 根据批次ID获取收款记录
     *
     * @param renewShouEntity
     * @return
     */
    @PostMapping("/getRenewShouList")
    public R getRenewShouList(@RequestBody RenewShouEntity renewShouEntity) {
        return renewManageTwoService.getRenewShouList(renewShouEntity);
    }

    /**
     * 提交收款记录
     *
     * @return
     */
    @PostMapping("/postSkList")
    public R postSkList(@RequestBody Map map) {
        return R.ok(renewManageTwoService.postSkList(map));
    }

    /**
     * 根据批次ID获取退款记录
     *
     * @param renewTuiEntity
     * @return
     */
    @PostMapping("/getRenewTuiList")
    public R getRenewTuiList(@RequestBody RenewTuiEntity renewTuiEntity) {
        return renewManageTwoService.getRenewTuiList(renewTuiEntity);
    }

    /**
     * 提交退款记录
     *
     * @return
     */
    @PostMapping("/postTkList")
    public R postTkList(@RequestBody Map map) {
        return R.ok(renewManageTwoService.postTkList(map));
    }

    /**
     * 保存已支付订单数据
     * @param map
     * @return
     */
    @PostMapping("/postSaveYzfOrder")
    public R postSaveYzfOrder(@RequestBody Map map) {
        return R.ok(renewManageTwoService.postSaveYzfOrder(map));
    }

    /**
     * 保存待续费订单数据
     * @param map
     * @return
     */
    @PostMapping("/postSaveDxfOrder")
    public R postSaveDxfOrder(@RequestBody Map map) {
        return R.ok(renewManageTwoService.postSaveDxfOrder(map));
    }

    /**
     * 续费提交
     * @param map
     * @return
     */
    @PostMapping("/postXf")
    public R postXf(@RequestBody Map map) {
        return R.ok(renewManageTwoService.postXf(map));
    }

    /**
     * 获取历史续费数据
     * @param map
     * @return
     */
    @PostMapping("/getRenewHistoryData")
    public R getRenewHistoryData(@RequestBody Map map){
        return R.ok(renewManageTwoService.getRenewHistoryData(map));
    }
}